---
keywords: ""
root: "/v5.1"
layout: "default"
title: "SingleValueDecodingContainer"
description: "Swift documentation for 'SingleValueDecodingContainer'"
---

<div class="intro-declaration"><code class="language-swift">protocol SingleValueDecodingContainer</code></div><p>A container that can support the storage and direct decoding of a single
nonkeyed value.</p>
<div class="discussion comment"></div><h3>Instance Variables</h3><div id="codingPath-038986a6e6564f0dd444735f926a6ca4" class="declaration"><a class="toggle-link" href="#comment-codingPath-038986a6e6564f0dd444735f926a6ca4">var codingPath</a> <span class="required">Required</span><div class="comment collapse in" id="comment-codingPath-038986a6e6564f0dd444735f926a6ca4"><p>The path of coding keys taken to get to this point in encoding.</p>
<h4>Declaration</h4><code class="language-swift">var codingPath: [CodingKey]</code></div></div><h3>Instance Methods</h3><div id="decode-8025df040b7adc85d770a524cec1c450" class="declaration"><a class="toggle-link" href="#comment-decode-8025df040b7adc85d770a524cec1c450">func decode(_ type: Bool.Type) throws -> Bool</a> <span class="required">Required</span><div class="comment collapse in" id="comment-decode-8025df040b7adc85d770a524cec1c450"><p>Decodes a single value of the given type.</p>
<ul>
<li>parameter type: The type to decode as.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">func decode(_ type: Bool.Type) throws -> Bool</code></div></div><div id="decode-8025df040b7adc85d770a524cec1c450" class="declaration"><a class="toggle-link" href="#comment-decode-8025df040b7adc85d770a524cec1c450">func decode(_ type: String.Type) throws -> String</a> <span class="required">Required</span><div class="comment collapse in" id="comment-decode-8025df040b7adc85d770a524cec1c450"><p>Decodes a single value of the given type.</p>
<ul>
<li>parameter type: The type to decode as.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">func decode(_ type: String.Type) throws -> String</code></div></div><div id="decode-8025df040b7adc85d770a524cec1c450" class="declaration"><a class="toggle-link" href="#comment-decode-8025df040b7adc85d770a524cec1c450">func decode(_ type: Double.Type) throws -> Double</a> <span class="required">Required</span><div class="comment collapse in" id="comment-decode-8025df040b7adc85d770a524cec1c450"><p>Decodes a single value of the given type.</p>
<ul>
<li>parameter type: The type to decode as.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">func decode(_ type: Double.Type) throws -> Double</code></div></div><div id="decode-8025df040b7adc85d770a524cec1c450" class="declaration"><a class="toggle-link" href="#comment-decode-8025df040b7adc85d770a524cec1c450">func decode(_ type: Float.Type) throws -> Float</a> <span class="required">Required</span><div class="comment collapse in" id="comment-decode-8025df040b7adc85d770a524cec1c450"><p>Decodes a single value of the given type.</p>
<ul>
<li>parameter type: The type to decode as.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">func decode(_ type: Float.Type) throws -> Float</code></div></div><div id="decode-8025df040b7adc85d770a524cec1c450" class="declaration"><a class="toggle-link" href="#comment-decode-8025df040b7adc85d770a524cec1c450">func decode(_ type: Int.Type) throws -> Int</a> <span class="required">Required</span><div class="comment collapse in" id="comment-decode-8025df040b7adc85d770a524cec1c450"><p>Decodes a single value of the given type.</p>
<ul>
<li>parameter type: The type to decode as.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">func decode(_ type: Int.Type) throws -> Int</code></div></div><div id="decode-8025df040b7adc85d770a524cec1c450" class="declaration"><a class="toggle-link" href="#comment-decode-8025df040b7adc85d770a524cec1c450">func decode(_ type: Int8.Type) throws -> Int8</a> <span class="required">Required</span><div class="comment collapse in" id="comment-decode-8025df040b7adc85d770a524cec1c450"><p>Decodes a single value of the given type.</p>
<ul>
<li>parameter type: The type to decode as.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">func decode(_ type: Int8.Type) throws -> Int8</code></div></div><div id="decode-8025df040b7adc85d770a524cec1c450" class="declaration"><a class="toggle-link" href="#comment-decode-8025df040b7adc85d770a524cec1c450">func decode(_ type: Int16.Type) throws -> Int16</a> <span class="required">Required</span><div class="comment collapse in" id="comment-decode-8025df040b7adc85d770a524cec1c450"><p>Decodes a single value of the given type.</p>
<ul>
<li>parameter type: The type to decode as.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">func decode(_ type: Int16.Type) throws -> Int16</code></div></div><div id="decode-8025df040b7adc85d770a524cec1c450" class="declaration"><a class="toggle-link" href="#comment-decode-8025df040b7adc85d770a524cec1c450">func decode(_ type: Int32.Type) throws -> Int32</a> <span class="required">Required</span><div class="comment collapse in" id="comment-decode-8025df040b7adc85d770a524cec1c450"><p>Decodes a single value of the given type.</p>
<ul>
<li>parameter type: The type to decode as.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">func decode(_ type: Int32.Type) throws -> Int32</code></div></div><div id="decode-8025df040b7adc85d770a524cec1c450" class="declaration"><a class="toggle-link" href="#comment-decode-8025df040b7adc85d770a524cec1c450">func decode(_ type: Int64.Type) throws -> Int64</a> <span class="required">Required</span><div class="comment collapse in" id="comment-decode-8025df040b7adc85d770a524cec1c450"><p>Decodes a single value of the given type.</p>
<ul>
<li>parameter type: The type to decode as.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">func decode(_ type: Int64.Type) throws -> Int64</code></div></div><div id="decode-8025df040b7adc85d770a524cec1c450" class="declaration"><a class="toggle-link" href="#comment-decode-8025df040b7adc85d770a524cec1c450">func decode(_ type: UInt.Type) throws -> UInt</a> <span class="required">Required</span><div class="comment collapse in" id="comment-decode-8025df040b7adc85d770a524cec1c450"><p>Decodes a single value of the given type.</p>
<ul>
<li>parameter type: The type to decode as.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">func decode(_ type: UInt.Type) throws -> UInt</code></div></div><div id="decode-8025df040b7adc85d770a524cec1c450" class="declaration"><a class="toggle-link" href="#comment-decode-8025df040b7adc85d770a524cec1c450">func decode(_ type: UInt8.Type) throws -> UInt8</a> <span class="required">Required</span><div class="comment collapse in" id="comment-decode-8025df040b7adc85d770a524cec1c450"><p>Decodes a single value of the given type.</p>
<ul>
<li>parameter type: The type to decode as.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">func decode(_ type: UInt8.Type) throws -> UInt8</code></div></div><div id="decode-8025df040b7adc85d770a524cec1c450" class="declaration"><a class="toggle-link" href="#comment-decode-8025df040b7adc85d770a524cec1c450">func decode(_ type: UInt16.Type) throws -> UInt16</a> <span class="required">Required</span><div class="comment collapse in" id="comment-decode-8025df040b7adc85d770a524cec1c450"><p>Decodes a single value of the given type.</p>
<ul>
<li>parameter type: The type to decode as.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">func decode(_ type: UInt16.Type) throws -> UInt16</code></div></div><div id="decode-8025df040b7adc85d770a524cec1c450" class="declaration"><a class="toggle-link" href="#comment-decode-8025df040b7adc85d770a524cec1c450">func decode(_ type: UInt32.Type) throws -> UInt32</a> <span class="required">Required</span><div class="comment collapse in" id="comment-decode-8025df040b7adc85d770a524cec1c450"><p>Decodes a single value of the given type.</p>
<ul>
<li>parameter type: The type to decode as.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">func decode(_ type: UInt32.Type) throws -> UInt32</code></div></div><div id="decode-8025df040b7adc85d770a524cec1c450" class="declaration"><a class="toggle-link" href="#comment-decode-8025df040b7adc85d770a524cec1c450">func decode(_ type: UInt64.Type) throws -> UInt64</a> <span class="required">Required</span><div class="comment collapse in" id="comment-decode-8025df040b7adc85d770a524cec1c450"><p>Decodes a single value of the given type.</p>
<ul>
<li>parameter type: The type to decode as.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">func decode(_ type: UInt64.Type) throws -> UInt64</code></div></div><div id="decode-8025df040b7adc85d770a524cec1c450" class="declaration"><a class="toggle-link" href="#comment-decode-8025df040b7adc85d770a524cec1c450">func decode(_ type: T.Type) throws -> T</a> <span class="required">Required</span><div class="comment collapse in" id="comment-decode-8025df040b7adc85d770a524cec1c450"><p>Decodes a single value of the given type.</p>
<ul>
<li>parameter type: The type to decode as.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">func decode&lt;T>(_ type: T.Type) throws -> T where T: Decodable</code></div></div><div id="decodeNil-362050c3db346d74dda0ee5db232b0e3" class="declaration"><a class="toggle-link" href="#comment-decodeNil-362050c3db346d74dda0ee5db232b0e3">func decodeNil() -> Bool</a> <span class="required">Required</span><div class="comment collapse in" id="comment-decodeNil-362050c3db346d74dda0ee5db232b0e3"><p>Decodes a null value.</p>
<h4>Declaration</h4><code class="language-swift">func decodeNil() -> Bool</code></div></div>